/*
 * ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
 * Without permission, no one has the right to obtain, disclose or use this software in any way.
 */
package com.ecarx.systemui.plugin.ui.navigationbar

import android.content.Context
import android.content.Intent
import android.util.AttributeSet
import android.view.View
import androidx.core.content.res.ResourcesCompat
import com.ecarx.systemui.plugin.R
import com.ecarx.systemui.plugin.ui.custom.SystemBarButton
import com.ecarx.systemui.plugin.utils.AppUtils
import com.ecarx.systemui.plugin.utils.LogUtils

class EnergyButton @JvmOverloads constructor(
    context: Context?,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : SystemBarButton(context, attrs, defStyleAttr) {
    init {
        setImageDrawable(
            ResourcesCompat
                .getDrawable(resources, R.drawable.dock_bar_energy_normal, getContext().theme)
        )
        setOnClickListener { v: View? ->
            LogUtils.i("EnergyButton ----> clicked ~")
            AppUtils.startEnergy(context, true)
        }
    }

    override fun getContentDescriptionString(): String {
        return "EnergyButton"
    }
}